home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13993 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  46 lines

  1. Path: news.voicenet.com!usenet
  2. From: deaton@cygnus.rsabbs.com
  3. Newsgroups: comp.lang.c
  4. Subject: 80x50 screen mode problems
  5. Date: 11 Apr 1996 06:41:53 GMT
  6. Organization: A poorly-installed InterNetNews site
  7. Message-ID: <4ki9jh$a6f@news.voicenet.com>
  8. NNTP-Posting-Host: d02.rsabbs.com
  9. X-Newsreader: SPRY News 3.03 (SPRY, Inc.)
  10.  
  11.    I'm writing a program in 80x50 text mode on an IBM PC. I'm making a BIOS call to set the cursor position--that part seems to work fine. 
  12. But when I attempt to write using printf() at that position it printf diagonally across the screen. Very strange. I'm sure it has something to do with the fact that 
  13. I'm using double the screen memory and rows, because it printf()'s fine so long as I don't set the cursor past (24,79), the normal screen memory. There is obviously a 
  14. sound logical reason for this occurance, but for the life of me I can't understand why. Could someone enlighten me?
  15.  
  16. This is the code:
  17. ------------------------------------
  18.  
  19. #include <stdio.h>
  20. #include <conio.h>
  21. #include <stdlib.h>
  22.  
  23. void main()
  24. {
  25.     unsigned char x=30,y=40;
  26.  
  27.     asm{ mov ax, 1112h     // Set character set to 8x8 font 
  28.                          mov bl, 0h        // thereby yeilding 80x50.
  29.                          int 10h           //Call interrup 10h, the video BIOS.
  30.                        }
  31.     
  32.                 fclrscr();             //My own function that clears 4000 bytes of VGA mem. Works fine.
  33.  
  34.     asm{ mov ah,0x02 //Request Set Cursor.
  35.              mov bh,0x0  //Page Number
  36.              mov dh,[y]  //Row
  37.              mov dl,[x]  //Collumn
  38.              int 0x10    //Call BIOS to position cursor.
  39.                        }
  40.  
  41.     printf("%d %d",x,y);
  42.     
  43.                 scanf("%*c");  //pause
  44.     return;
  45. }
  46.